package com.zyh.demo;

import java.io.*;

/**
 * @Author zyh
 * @Date 2024/8/6 11:18
 * @Description 模拟Scanner和系统输出
 */

public class IODemo2 {
    public static void main(String[] args) throws IOException {
        //模拟Scanner
        //创建一个转换流
        InputStreamReader inputStreamReader = new InputStreamReader(System.in);
        //加buff
        BufferedReader br=new BufferedReader(inputStreamReader);
        System.out.println("请输入用户名：");
        String username = br.readLine();
//        System.out.println(s);


        //模拟系统输出
        //创建一个转换流
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(System.out);
        //加buff
        BufferedWriter bw=new BufferedWriter(outputStreamWriter);
        bw.write("username="+username);
        bw.newLine();
        bw.flush();
        bw.close();
        br.close();

    }
}
